//
// Created by 30986 on 2020/11/25.
//完数：一个数恰好是它包括1在内的所有因子之和

#include "Ex02041.h"
#include <iostream>
using namespace std;

int main(){
    for (int i = 2; i <=1000 ; ++i) {
        int sum =1;
        for (int j = 2; j <= i/2; ++j) {   //   <=...
            if(i%j == 0) {sum+=j; cout<<j<<" ";}
        }
        if(sum == i) cout<<i<<"\n";
    }
}
/*
 * 结果
6 = 1+2+3
28 =1+2+4+7+14
496
 */